package com.anjubao.parking.municipal.roadside.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 地锁状态
 * @author zhuchunfeng
 * @date 2019/6/14 10:18
 */
@Getter
@AllArgsConstructor
public enum LockEnum {

    CLOSE(1, "关闭地锁"),
    OPEN(2, "打开地锁");

    private Integer code;

    private String desc;

    public static String getDescByCode(Integer code) {
        for (LockEnum e : LockEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }

    public static Boolean exist(Integer code) {
        for (LockEnum e : LockEnum.values()) {
            if (e.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }
}
